package com.xuanque.mahjongDice.ScrollBarui {
	
	import flash.display.*;
	import flash.events.*;
	import flash.text.*;

	public class ScrollTextDealWith_Y extends EventDispatcher {
		
		private var _stage:DisplayObjectContainer;
		
		private var content_txt:TextField;
		private var up_btn:DisplayObject;
		private var down_btn:DisplayObject;
		
		private var speed:uint = 1;
		
		public function ScrollTextDealWith_Y(content_txt:TextField,up_btn:DisplayObject,down_btn:DisplayObject,stage):void {
			
			this._stage = stage;
			this.content_txt = content_txt;
			this.up_btn = up_btn;
			this.down_btn = down_btn;
			
			DealWithChildren();
			
		}
		private function DealWithChildren():void {
			
			//this.dispatch();
			//this._stage.addEventListener(ScrollBoxEvent.THUMB_VALUE, sbChange);
			
			addListener();
		}
		
		private function dispatch() {
			
		}
		
		private function addListener() {
			
			this.up_btn.addEventListener(MouseEvent.MOUSE_DOWN, upHandler);
			this.down_btn.addEventListener(MouseEvent.MOUSE_DOWN, downHandler);
		}
		
		private function upHandler(event:MouseEvent):void {
			
			if (this.content_txt.scrollV > 1){
				this.content_txt.scrollV -= this.speed;
				//trace(this.content_txt.scrollV);
			}
			
		}
		
		private function downHandler(event:MouseEvent):void {
			
			if(this.content_txt.scrollV < this.content_txt.maxScrollV){
				this.content_txt.scrollV += this.speed;
				//trace(this.content_txt.scrollV);
			}
			
		}
		
		
	}
}